const mongoose = require('mongoose')

const Image = mongoose.model('Image')

const popular = async() =>
    await Image.find({}).sort({likes:-1}).limit(6)
    .then(images => images)
    .catch(err => ctx.throw(500, err))


module.exports = popular
